<!--
 * @Author: your name
 * @Date: 2021-11-14 09:11:11
 * @LastEditTime: 2021-11-14 09:31:05
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue-note\day03\05.用户登录切换的案例.html
-->
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>05.用户登录切换的案例</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <span v-if="isUser">
        <label for="username">用户账号</label>
        <input
          type="text"
          id="username"
          placeholder="用户账号"
          key="username"
        />
      </span>
      <span v-else>
        <label for="emil">用户邮箱</label>
        <!-- 加了key之后就不会拿原来的修改 -->
        <input type="text" id="emil" placeholder="用户邮箱" key="emil" />
      </span>
      <button @click="isUser = !isUser">切换类型</button>
    </div>
    <script>
      new Vue({
        el: "#app",
        data: {
          msg: "hello",
          isUser: true,
        },
      });
    </script>
  </body>
</html>
